<?php

declare (strict_types=1);

namespace app\store\model\groupon;

use app\common\model\groupon\TaskUsers as TaskUsersModel;

/**
 * 拼团拼单成员模型
 * Class TaskUsers
 * @package app\store\model\groupon
 */
class TaskUsers extends TaskUsersModel
{
    /**
     * 获取列表数据
     * @param int $taskId 拼单ID
     * @return \think\Paginator
     * @throws \think\db\exception\DbException
     */
    public function getList(int $taskId): \think\Paginator
    {
        return $this->with(['user.avatar', 'robot.avatar'])
            ->where('task_id', '=', $taskId)
            ->order(['create_time' => 'desc'])
            ->paginate();
    }
}